#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
using namespace std;
int a[101][101];

class Student{
public:
	bool operator < (const Student& other)
	{
		if (wins > other.wins)
		{
			return true;
		}
		if (wins < other.wins)
		{
			return false;
		}
		return idx < other.idx;
	}
	Student(int _idx)
	{
		idx = _idx;
		wins = 0;
	}
	int idx;
	int wins;
};
int main3224()
{
	int N;
	cin >> N;

	for (int i = 0;i<N;i++)
	{
		for (int j = 0;j<N;j++)
		{
			cin >> a[i][j];
		}
	}

	vector<Student> students;
	for (int i = 0;i<N;i++)
	{
		students.push_back(Student(i));
	}
	for (int i = 0;i<N;i++)
	{
		
		for (int j = 0;j<N;j++)
		{
			if (a[i][j] == 3)
			{
				students[i].wins ++;
			}
		}
	}
	sort(students.begin(),students.end());

	cout << students[0].idx + 1 << endl;
	return 0;

}